<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .test {
            border: 1px solid red;
        }

        h1 {
            /* width: 25.5px; */
            color: rgb(84, 84, 119);
        }

        canvas {
            margin-top: 40px;
            /* border: 4px solid rebeccapurple; */
        }

        .icon {
            width: 60px;
            height: 50px;
            background: url('./imgs/cat.jpg') no-repeat;
            background-size: 100% 100%;
        }

        .icon2 {
            width: 60px;
            height: 50px;
            background: url('./imgs/BBGS.jpg') no-repeat;
            background-size: 100% 100%;
        }

        .list {
            padding: 10px 20px;
        }

        .item {
            display: flex;
            margin-bottom: 10px;
            box-shadow: 0px 2px 20px #999;
            border-radius: 10px;
        }

        .icon {
            border-radius: 10px;
        }

        .rt {
            padding-left: 10px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .test {
            display: flex;
            height: 100px;
        }

        .star {
            display: block;
            width: 50px;
            height: 50px;
            margin-left: 20px;
        }
    </style>
</head>

<body>
    <h1>canvas绘制测试1 自定义dom测试</h1>
    <div class="test">
        <star class="star" num="3" x="1"></star>
        <star class="star" num="4" x="100"></star>
        <star class="star" num="5" x="200"></star>
        <star class="star" num="6" x="300"></star>
        <star class="star" num="7" x="400"></star>
        <star class="star" num="8" x="500"></star>
        <star class="star" num="5" fill="true" stroke="false" x="600"></star>

    </div>
    <h1>canvas绘制</h1>
    <canvas id="canvas"></canvas>
</body>
<script src="../dist/main.js"></script>

<script>
    const root = document.querySelector(".test")
    layout(root, 'canvas')
    let timer;
    window.addEventListener('resize', () => {
        if (timer) { clearTimeout(timer) }
        timer = setTimeout(function () {
            layout(root, 'canvas')

        }, 100);
    })
</script>

</html>